<template>
  <div class="welcome">
  
 <component :is="dictData.rendertpl" v-if="dictData.rendertpl!=''"></component>



 </div>

</template>

<script lang="ts">
import { ref, computed, onMounted, nextTick,reactive,watchEffect} from "vue";
import { defineAsyncComponent } from 'vue';
import router from "/@/router";
export default {
  name: "welcome",
   setup({root}){
       const dictData=reactive({
         rendertpl:'',
       });
       watchEffect(() => {
         initLayout();
       })
       //初始化模板
        function initLayout(){
            let path = router.currentRoute.value.path;
            let id = router.currentRoute.value.params.id;
            console.log(path+">>>>>>>>"+id);

            dictData.rendertpl=defineAsyncComponent(()=>import('/@/views/layout/'+id+'.vue'));
        };
        //页面挂载完后执行初始化模板
        onMounted(()=>{
           initLayout();
        })

      return{
          dictData,
      }
   },

}
</script>
<style>
 .welcome{
   height: 100%;
   width: 100%;
   overflow: auto;
 }



</style>
